package com.wifipositioner.measure;

import java.util.ArrayList;

public class MeasuredPointList extends ArrayList<MeasuredPoint>{
	
	ArrayList<String> refNameList = new ArrayList<String>();
	
	@Override
	public boolean add(MeasuredPoint measuredRefPoint){
		if(refNameList.contains(measuredRefPoint.getName())){
			for(MeasuredPoint containedRefPoint : this){
				if(measuredRefPoint.getName().equals(containedRefPoint.getName())){
					remove(containedRefPoint);
					break;
				}
			}
		}
		else{
			refNameList.add(measuredRefPoint.getName());
		}
		super.add(measuredRefPoint);
		return false;
	}

}
